<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Author" content="李艺江">
<title>用户管理</title>
<style>
html, body {
	width: 100%;
	height: 100%;
	margin: 0;
}

a {
	text-decoration: none;
	padding-left: 2px
}

.container {
	position: relative;
	width: 100%;
	height: 100%;
}

.header {
	position: relative;
	width: 100%;
	height: 15%;
	background-color: #66CC00;
}

.divide {
	width: 100%;
	height: 1%;
	background-color: #DDDDDD;
}

.content {
	position: relative;
	width: 100%;
	height: 68%;
}

.content-left {
	width: 15%;
	height: 600px;
	float: left;
	background-color: #66CC00;
}

.content-right {
	width: 85%;
	height: 600px;
	float: left;
	background:
		url(${pageContext.request.contextPath }/pages/image/background.jpg);
}

.title {
	text-align: center;
}

.title font {
	font-size: 40px;
}

.user {
	text-align: right;
}

.user font {
	font-size: 20px;
}

.content-left div {
	width: 90%;
	background-color: #FFFFFF;
}

.content-left div li {
	height: 25px;
	background-color: #FFFFFF;
}

.table {
	width: 100%;
	padding-left: 1%;
}

.table table {
	border-collapse: collapse;
	background-color: #FFFFFF
}

.col1, .col2, .col3 {
	border: solid #66CC00;
	border-width: 2px;
	width: 180px;
	text-align: center;
}

.col4 {
	border: solid #66CC00;
	border-width: 2px;
	width: 480px;
	text-align: center;
}
</style>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/pages/js/pagination.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/pages/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
	//全局变量
	var numCount; //数据总数量
	var columnsCounts; //数据列数量
	var pageCount; //每页显示的数量
	var pageNum; //总页数
	var currPageNum; //当前页数

	//页面标签变量
	var blockTable;
	var preSpan;
	var firstSpan;
	var nextSpan;
	var lastSpan;
	var pageNumSpan;
	var currPageSpan;
	var numCounts;

	window.onload = function() {
		//页面标签变量
		blockTable = document.getElementById("blocks");
		preSpan = document.getElementById("spanPre");
		firstSpan = document.getElementById("spanFirst");
		nextSpan = document.getElementById("spanNext");
		lastSpan = document.getElementById("spanLast");
		pageNumSpan = document.getElementById("spanTotalPage");
		currPageSpan = document.getElementById("spanPageNum");
		numCounts = document.getElementById("numCount");

		numCount = document.getElementById("blocks").rows.length - 1; //取table的行数作为数据总数量（减去标题行1）
		numCounts.innerHTML = numCount;
		columnsCounts = blockTable.rows[0].cells.length;
		pageCount = 5;
		pageNum = parseInt(numCount / pageCount);
		if (0 != numCount % pageCount) {
			pageNum += 1;
		}

		firstPage();
	};
</script>

</head>
<body>
	<div class=container>
		<div class="header">
			<div class="title">
				<br /> <font>问卷调研管理系统</font>
			</div>
			<div class="user">
				<font>欢迎您:admin&nbsp;&nbsp;</font>
			</div>
		</div>
		<div class="divide"></div>
		<div class="content">
			<div class="content-left">
				<ul>
					<li>调查课题管理
						<div>
							<ul>
								<li><a href="admin_allQuestionnaires.action?x=x">调查课题管理</a></li>
								<li><a href="admin_send.action?page=aq">添加新课题</a></li>
							</ul>
						</div>
					</li>
					<li>留言信息管理
						<div>
							<ul>
								<li><a href="admin_allMessages.action?x=x">留言信息管理</a></li>
							</ul>
						</div>
					</li>
					<li>注册用户管理
						<div>
							<ul>
								<li><a href="admin_allUsers.action?x=x">注册用户管理</a></li>
							</ul>
						</div>
					</li>
					<li>调查记录查询
						<div>
							<ul>
								<li><a href="admin_allQuestionnaires.action?x=x">调查记录查询</a></li>
							</ul>
						</div>
					</li>
					<li>修改个人密码
						<div>
							<ul>
								<li><a href="admin_send.action?page=cp">修改个人密码</a></li>
							</ul>
						</div>
					</li>
					<li>退出登录
						<div>
							<ul>
								<li><a href="login_logout.action?x=x">退出登录</a></li>
							</ul>
						</div>
					</li>
				</ul>
			</div>
			<div class="content-right">
				<br />
				<div class="search">
					&nbsp;<label>课题：</label><input name="search" type="text">&nbsp;
					<button>搜索</button>
				</div>
				<br />
				<div class="table">
					<table id="blocks">
						<tr>
							<th class="col1">用户名</th>
							<th class="col2">id</th>
							<th class="col3">密码</th>
							<th class="col4">操作</th>
						</tr>
						<c:forEach var="user" items="${requestScope.allUsers }">
						  <tr>
							<td class="col1">${user.name }</td>
							<td class="col2">${user.id }</td>
							<td class="col3">${user.password }</td>
							<td class="col4">
							  <a href="admin_changeUser.action?uid=${user.id }">修改</a> 
							  <a href="admin_deleteUser.action?uid=${user.id }">删除</a> 
							  <a href="admin_userMessages.action?uid=${user.id }">所有留言</a> 
							  <a href="admin_userQuestionnaires.action?uid=${user.id }">所有参与的调查项目</a>
							 </td>
						  </tr>
						</c:forEach>
					</table>
					<div id="pagiDiv">
						<span>共有</span><span id="numCount"></span><span>条记录</span> <span
							id="spanPageNum"></span>/<span id="spanTotalPage"></span> <span
							id="spanFirst">【首页】</span> <span id="spanPre">【上一页】</span> <span
							id="spanNext">【下一页】</span> <span id="spanLast">【尾页】</span>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>